/*!
 * avangard/chat/message.js
 * © 2009 avangardonline.ru
 * @author BlooDHounD <http://www.controller.by>
 */

if ( !window.controller ) throw new Error( '"controller" not initialized' );

controller.require( 'avangard.chat' );

if ( !avangard.chat.Message ) {

	controller.require( 'controller.Logger.TextLog' );

	/**
	 * @class
	 * @namespace	avangard.chat
	 * @extends		controller.Logger.TextLog
	 * @author		BlooDHounD	<http://www.controller.by>
	 */
	avangard.chat.Message = ( function() {

		//--------------------------------------------------------------------------
		//
		//  Class variables
		//
		//--------------------------------------------------------------------------

		var	$ =		controller;

		//--------------------------------------------------------------------------
		//
		//  Constructor
		//
		//--------------------------------------------------------------------------

		/**
		 * @constructor
		 * @param	{Number}	id
		 * @param	{Number}	type
		 * @param	{String}	sender
		 * @param	{String}	text
		 * @param	{Number}	sendTime
		 */
		var Message = function(id, type, sender, text, sendTime) {
			Message.superPrototype.constructor.call( this, text );
			this.id =		id;
			this.type =		type;
			this.sender =	sender;
			this.sendTime =	sendTime;
		};

		$.extend( Message, $.Logger.TextLog );

		var MessagePrototype = Message.prototype;

		//--------------------------------------------------------------------------
		//
		//  Properties
		//
		//--------------------------------------------------------------------------

		/**
		 * @type	{Number}
		 */
		MessagePrototype.id = 0;

		/**
		 * @type	{Number}
		 */
		MessagePrototype.type = 0;

		/**
		 * @type	{String}
		 */
		MessagePrototype.sender = null;

		/**
		 * @type	{Number}
		 */
		MessagePrototype.sendTime = null;

		//--------------------------------------------------------------------------
		//
		//  Methods
		//
		//--------------------------------------------------------------------------

		/**
		 * @method
		 * @return	{String}
		 */
		MessagePrototype.toString = function() {
			return '[Message object]';
		};

		//--------------------------------------------------------------------------
		//
		//  Class methods
		//
		//--------------------------------------------------------------------------

		/**
		 * @static
		 * @method
		 * @return	{String}
		 */
		Message.toString = function() {
			return '[class Message]';
		};

		return Message;

	}() );

}